<?php
 /*******************************************************************************
 * @filename: product.php
 *
 * @author: immer_baldos
 *
 * @description: product model
 *
 * @history:
 *
 *   VERSION   DATE                   BY          NOTES
 *  ---------------------------------------------------------------
 *     1.0     September  9, 2009     immer       initial bake
 *
 *     2.0     September 12, 2009     immer       add validation rules
 *
 ******************************************************************************/
class Product extends AppModel {

	var $name = 'Product';
    var $validate = array(
        'name' => array(
            'rule' => 'notEmpty',
            'message' => 'Please supply a name for the product.'
        ),
        'description' => array(
            'rule' => 'notEmpty',
            'message' => 'Please supply a description for the product.'
        ),
        'instock' => array(
            'rule' => 'numeric',
            'message' => 'Please supply the available stock for the product.'
        ),
        'sold' => array(
            'rule' => 'numeric',
            'message' => 'Please supply a number.'
        ),
        'price' => array(
            'rule' => 'numeric',
            'message' => 'Please supply the unit price for the product.'
        )
    );

	//The Associations below have been created with all possible keys, those that are not needed can be removed
	var $hasMany = array(
		'Transaction' => array(
			'className' => 'Transaction',
			'foreignKey' => 'product_id',
			'dependent' => false,
			'conditions' => '',
			'fields' => '',
			'order' => '',
			'limit' => '',
			'offset' => '',
			'exclusive' => '',
			'finderQuery' => '',
			'counterQuery' => ''
		)
	);

}
?>